
ReDotsInvasionHighRewardHandler ={};
local this = ReDotsInvasionHighRewardHandler;

function this.init()
    CloseEvent(Config.EventType.InvasionStageRewardChange,this.update);
    ListenEvent(Config.EventType.InvasionStageRewardChange,this.update);
    return this;
end

function this.getFlag(...)
    if not logicMgr.FuncOpenManager.isOpen(Config.FuncOpenType.InvasionBattle,false) then
        return Config.RedDotsFlagState.None
    end
    if not logicMgr.InvasionManager.IsOpen() then
        return Config.RedDotsFlagState.None
    end
    local countRemain, highRewardEndTime = logicMgr.InvasionManager.GetInvasionHighRewardInfo()
    local countTime = highRewardEndTime - HelperFunc.GetServerTime()
    local state = logicMgr.ActiveManager.getActiveOpenStatus("InvasionHighReward",1)
    if state and countRemain > 0 and countTime <= 0 then
        return Config.RedDotsFlagState.Needful
    else
        return Config.RedDotsFlagState.None
    end
    return state
end

function this.update()
    RedDotsManager.addBroadcast(Config.RedDotsType.InvasionHighReward);
end